<template>
  <div class="sjplatformAdd">
    <el-form label-width="100px">
      <el-form-item label="机构名称：">
        <el-input v-model="orgStore.orgModel.orgName" />
      </el-form-item>
      <el-form-item label="上级机构：">
        <el-tree-select
          v-model="orgStore.orgModel.pName"
          :data="orgTreeData"
          check-strictly
          :render-after-expand="false"
          @node-click="handleNodeClick"
          placeholder="请选择..."
        />
      </el-form-item>
      <el-form-item label="机构类型：">
        <el-select v-model="orgStore.orgModel.orgType" clearable placeholder="请选择...">
          <el-option label="公司" :value="1" />
          <el-option label="部门" :value="2" />
        </el-select>
      </el-form-item>
      <el-form-item label="描述：">
        <el-input v-model="orgStore.orgModel.mark" type="textarea" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script lang="ts" setup>
import { useOrgOperation } from "../../../hooks/SystemManager/Org/useOrgAddOrUpdate";

const { orgStore, orgTreeData } = useOrgOperation();

const handleNodeClick = (node) => {
  orgStore.orgModel.pid = node.id;
  orgStore.orgModel.pName = node.label;
};
</script>